package com.example.weixinpayment.service;

import java.io.IOException;
import java.util.Map;

public interface WxPayService {
    /**
     * @description: 向微信支付平台发起下单请求 保存订单并返回支付二维码链接
     * @param: productId
     * @return: java.util.Map<java.lang.String, java.lang.Object>
     * @author: 刘助政
     * @date: 2021/12/29 17:04
     * */
    Map<String, Object> nativePay(Long productId) throws Exception;

    /**
     * @description: 微信支付扫码支付成功回调处理订单
     * @param: body
     * @return: void
     * @author: 刘助政
     * @date: 2022/1/11 16:02
     * */
    void processOrder(Map<String, Object> body);

    /**
     * @description: 根据订单号取消订单
     * @param: orderNo
     * @return: void
     * @author: 刘助政
     * @date: 2022/1/11 17:39
     * */
    void cancelOrder(String orderNo) throws Exception;

    /**
     * @description: 根据订单号从微信端查询订单
     * @param: orderNo
     * @return: java.lang.String
     * @author: 刘助政
     * @date: 2022/1/11 18:54
     * */
    String queryOrder(String orderNo) throws Exception;

    /**
     * @description: 微信端根据订单号核实订单状态
     * @param: orderNo
     * @return: void
     * @author: 刘助政
     * @date: 2022/1/11 19:34
     * */
    void checkOrderStatus(String orderNo) throws Exception;
    
    /**
     * @description: 退款
     * @param: orderNo
     * @param: reason
     * @return: void
     * @author: 刘助政
     * @date: 2022/1/12 14:35
     * */
    void refund(String orderNo, String reason) throws Exception;

    /**
     * @description: 处理退款单
     * @param: bodyMap
     * @return: void
     * @author: 刘助政
     * @date: 2022/1/12 15:12
     * */
    void processRefund(Map<String, Object> bodyMap);

    /**
     * @description: 查询退款
     * @param: refundNo
     * @return: java.lang.String
     * @author: 刘助政
     * @date: 2022/1/12 15:31
     * */
    String queryRefund(String refundNo) throws  Exception;

    /**
     * @description: 核实订单状态：调用微信支付查询退款接口
     * @param: refundNo
     * @return: void
     * @author: 刘助政
     * @date: 2022/1/12 15:50
     * */
    void checkRefundStatus(String refundNo) throws Exception;
    
    /**
     * @description: 获取账单
     * @param: billDate 账单日期
     * @param: type 账单类型 交易账单和资金账单
     * @return: java.lang.String
     * @author: 刘助政
     * @date: 2022/1/12 16:10
     * */
    String queryBill(String billDate, String type) throws Exception;

    /**
     * @description: 下载账单
     * @param: billDate 账单日期
     * @param: type 账单类型 交易账单和资金账单
     * @return: java.lang.String
     * @author: 刘助政
     * @date: 2022/1/12 16:13
     * */
    String downloadBill(String billDate, String type) throws Exception;
}
